using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.EBooks;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using BusinessObjects.BO_Actions.Articles;
namespace BusinessObjects.BO_GetObjects
{
    public static class BO_EBooks
    {
        public static DataTable SelectAll(int status)
        {
            try
            {
                BOEBooks_Select_All action = new BOEBooks_Select_All();
                usp_EBooks_Select_All entity = new usp_EBooks_Select_All();
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status)
        {
            try
            {
                BOEBooks_Select_Top action = new BOEBooks_Select_Top();
                usp_EBooks_Select_Top entity = new usp_EBooks_Select_Top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable Search(int ebook_id)
        {
            try
            {
                BOEBooks_Search action = new BOEBooks_Search();
                usp_EBooks_Search entity = new usp_EBooks_Search();
                entity.EBOOK_ID = ebook_id;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
        {
            try
            {
                BOEBooks_Select_WithPaged action = new BOEBooks_Select_WithPaged();
                usp_EBooks_Select_WithPaged entity = new usp_EBooks_Select_WithPaged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(int category_id, string book_code, string short_book_title, string full_book_title, string short_book_description, string full_book_description, string thumb_img, string file_name, string book_detail, string meta_keyword, string meta_description, string tags, int total_download, int total_view, bool is_display_on_home_page, string module_id, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status)
        {
            try
            {
                BOEBooks_Insert action = new BOEBooks_Insert();
                usp_EBooks_Insert entity = new usp_EBooks_Insert();
                entity.CATEGORY_ID = category_id;
                entity.BOOK_CODE = book_code;
                entity.SHORT_BOOK_TITLE = short_book_title;
                entity.FULL_BOOK_TITLE = full_book_title;
                entity.SHORT_BOOK_DESCRIPTION = short_book_description;
                entity.FULL_BOOK_DESCRIPTION = full_book_description;
                entity.THUMB_IMG = thumb_img;
                entity.FILE_NAME = file_name;
                entity.BOOK_DETAIL = book_detail;
                entity.META_KEYWORD = meta_keyword;
                entity.META_DESCRIPTION = meta_description;
                entity.TAGS = tags;
                entity.TOTAL_DOWNLOAD = total_download;
                entity.TOTAL_VIEW = total_view;
                entity.IS_DISPLAY_ON_HOME_PAGE = is_display_on_home_page;
                entity.MODULE_ID = module_id;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Update(Int64 ebook_id, int category_id, string book_code, string short_book_title, string full_book_title, string short_book_description, string full_book_description, string thumb_img, string file_name, string book_detail, string meta_keyword, string meta_description, string tags, int total_download, int total_view, bool is_display_on_home_page, string module_id, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status)
        {
            try
            {
                BOEBooks_Update action = new BOEBooks_Update();
                usp_EBooks_Update entity = new usp_EBooks_Update();
                entity.EBOOK_ID = ebook_id;
                entity.CATEGORY_ID = category_id;
                entity.BOOK_CODE = book_code;
                entity.SHORT_BOOK_TITLE = short_book_title;
                entity.FULL_BOOK_TITLE = full_book_title;
                entity.SHORT_BOOK_DESCRIPTION = short_book_description;
                entity.FULL_BOOK_DESCRIPTION = full_book_description;
                entity.THUMB_IMG = thumb_img;
                entity.FILE_NAME = file_name;
                entity.BOOK_DETAIL = book_detail;
                entity.META_KEYWORD = meta_keyword;
                entity.META_DESCRIPTION = meta_description;
                entity.TAGS = tags;
                entity.TOTAL_DOWNLOAD = total_download;
                entity.TOTAL_VIEW = total_view;
                entity.IS_DISPLAY_ON_HOME_PAGE = is_display_on_home_page;
                entity.MODULE_ID = module_id;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Delete(int ebook_id)
        {
            try
            {
                BOEBooks_Delete action = new BOEBooks_Delete();
                usp_EBooks_Delete entity = new usp_EBooks_Delete();
                entity.EBOOK_ID = ebook_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Restore(int ebook_id)
        {
            try
            {
                BOEBooks_Restore action = new BOEBooks_Restore();
                usp_EBooks_Restore entity = new usp_EBooks_Restore();
                entity.EBOOK_ID = ebook_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectAdmin(int startIndex, int pageCount, int module_id, string keyword, int category_id)
        {
            try
            {
                BOEbooks_Select_Admin action = new BOEbooks_Select_Admin();
                usp_Ebooks_Select_Admin entity = new usp_Ebooks_Select_Admin();
                entity.KEYWORD = keyword;
                entity.MODULE_ID = module_id;
                entity.CATEGORY_ID = category_id;
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Display(int ebook_id, int module_id)
        {
            try
            {
                BOEBooks_Display action = new BOEBooks_Display();
                usp_EBooks_Display entity = new usp_EBooks_Display();
                entity.EBOOK_ID = ebook_id;
                entity.MODULE_ID = module_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectByModule(int status, int startindex, int maxrecord, int module_id)
        {
            try
            {
                BOEBooks_Select_By_Module action = new BOEBooks_Select_By_Module();
                usp_Ebooks_Select_By_Module entity = new usp_Ebooks_Select_By_Module();
                entity.MAXRECORDS = maxrecord;
                entity.MODULE_ID = module_id;
                entity.STARTINDEX = startindex;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectByCategory(int category_id, int start, int maxrecord)
        {
            try
            {
                BOEBooks_Select_By_Category action = new BOEBooks_Select_By_Category();
                usp_Ebooks_Select_By_Category entity = new usp_Ebooks_Select_By_Category();
                entity.CATEGORY_ID = category_id;
                entity.STARTINDEX = start;
                entity.MAXRECORDS = maxrecord;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
